﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

namespace DocGia.VO
{
    public class DGVO
    {
        private string _MaDG;

        public string MDG
        {
            get { return _MaDG; }
            set { _MaDG = value; }
        }
        private string _TenDG;

        public string TDG
        {
            get { return _TenDG; }
            set { _TenDG = value; }
        }
        private DateTime _NgaySinh;

        public DateTime NS
        {
            get { return _NgaySinh; }
            set { _NgaySinh = value; }
        }
        private string _DiaChi;

        public string DC
        {
            get { return _DiaChi; }
            set { _DiaChi = value; }
        }
        public DGVO()
        {

        }
        public DGVO(string ma,string ten, DateTime ns, string dc)
        {
            this._MaDG = ma;
            this._TenDG = ten;
            this._NgaySinh = ns;
            this._DiaChi = dc;
        }
        public void CreateFrom(DataRow dr)
        {
            if (dr != null)
            {
                this._MaDG = dr.IsNull(0) ? string.Empty : Convert.ToString(dr[0]);
                this._TenDG= dr.IsNull(1) ? string.Empty : Convert.ToString(dr[1]);
                this._NgaySinh= dr.IsNull(1) ? NS : Convert.ToDateTime(dr[2]);
                this._DiaChi = dr.IsNull(3) ? string.Empty : Convert.ToString(dr[3]);
                
            }
        }
    }
}
